#include "PhysicsBox.h"
#include "OpenGL.h"
#include "math.h"
#include <iostream>
using namespace std;
PhysicsBox::PhysicsBox(float size){
	width = size;
	height = size;
	depth = size;
}
PhysicsBox::PhysicsBox(float _width, float _height, float _depth){
	throw("Irregular sized boxes not yet implemented");
	width = _width;
	height = _height;
	depth = _depth;
}
void PhysicsBox::renderInternal(){
	glScalef(width, height, depth);
	glutSolidCube(1.0);
}
float PhysicsBox::inertia(){	//Needs to be moved to a tensor, is incorrect for rects
	return 1.0f/6.0f * getMass() * width * width;
}
OBoundingBox PhysicsBox::getOBoundingBox(){
	OBoundingBox ret;
	ret.position = current.position;
	ret.orientation = current.orientation;
	ret.extents = PhysicsVector(width, height, depth);
	return ret;
}
float PhysicsBox::getBoundingSphere(){
	return sqrt(width*width+height*height+depth*depth)* 1.0f/2.0f;
}
